package com.pomr.util.communication.cx216;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSONObject;
import com.pomr.util.communication.Communication;

/**
 * 
 * 类名称： CX216Back
 * 创建人： Administrator
 * 创建时间：2018年5月8日 下午12:04:39
 * 类描述：近30日流量使用情况 出参
 */
public class CX216Back implements Communication,Serializable{
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getCodeName() {
		return codeName;
	}
	public void setCodeName(String codeName) {
		this.codeName = codeName;
	}
	public List<CX216BackBase> getUseDataInfo() {
		return useDataInfo;
	}
	public void setUseDataInfo(List<CX216BackBase> useDataInfo) {
		this.useDataInfo = useDataInfo;
	}
	private int code;//查询状态
	private String codeName;
	private List<CX216BackBase> useDataInfo;//每日流量信息 数组
	
	public static Object fromJson(String jsonStr) {
//		jsonStr = "{"+
//"'code': 0,"+
//"'useDataInfo': ["+
//"{"+
//"'days': '2016-12-21',"+
//"'onedayUseData': 0"+
//"},"+
//"{"+
//"'days': '2017-1-19',"+
//"'onedayUseData': 696.51"+
//"}"+
//"]"+
//"}";
		CX216Back back = (CX216Back)JSONObject.parseObject(jsonStr, CX216Back.class);
		//查询状态
		if(back.getCode() == 0){
			back.setCodeName("查询正常");
		}else if(back.getCode() == 1){
			back.setCodeName("appid、secret、sign有误");
		}else if(back.getCode() == 2){
			back.setCodeName("imsi、iccid、msisdn有误");
		}else if(back.getCode() == 9999){
			back.setCodeName("意外错误");
		}
		return back;
	}

}
